DZApp.service(
				'orderAlreadyPaidLogService',
				function(commonService) {
					return {
						query : function(postData) {
							var url = "/operationService/queryOrderPayLog";
							return commonService
									.commonAjaxByPost(url, postData);
						},
						calculateOrderPrice : function(postData) {
							var url = "/operationService/calculateOrderPrice";
							return commonService
							.commonAjaxByPost(url, postData);
						},
                        listMerchantByManagerId : function(postData) {
                            var url = "/operationService/listMerchantByManagerId";
                            return commonService
                                .commonAjaxByPost(url, postData);
                        },
						changeOrderAmount : function(postData) {
							var url = "/operationService/changeOrderAmount";
							return commonService
							.commonAjaxByPost(url, postData);
						},
						validate : function($scope) {
							return true;
						}
					};
				});
DZApp.controller('orderAlreadyPaidlogController', function($scope, orderAlreadyPaidLogService,
		$state) {
	$scope.orderInfo = {};
	$scope.orderItemlist = {};
	$scope.queryMainSeviceSelect = {};
    $scope.orderSummaryModel={}
	$scope.query = {};
	$scope.aValue = '';
	$scope.isNeedConditionValidate = false;
	var pagation ={
			prePageNum:20,
			curPageNo:1,
			curPageNo:1,
			param:null
	};
	// 翻页出发分析
	$scope.onPageChange = function() {
		pagation.curPageNo = $scope.currentPage;
		queryPagination($.param(pagation));
	};
	
	// 分页回调函数
	var doResponseCallback = function(data) {
		if ("success" == data.retCode) {
			var data  = eval(data.bizData);
			$scope.query = data.list;
			$scope.orderItemlist = data.orderItemlist;
			$scope.pageCount = data.totalPage;
		} else {
			bootboxWindow.alert('警告查询错误:' + data.errorMsg, null);
		}
	};
	// 參數封裝
	var doParam = function(){
		pagation.param = JSON.stringify($scope.orderSummaryModel);
		return $.param(pagation);
	}
	// 分页查询
	var queryPagination = function(param){
		$scope.query = null;
	//	$('#table_1').DataTable().destroy();
        orderAlreadyPaidLogService.query(param).then(doResponseCallback);
	}
	
	// 是否初始化的就查询
	var isQueryInit = true;
	if (isQueryInit) {
		queryPagination(doParam());
	}
    orderAlreadyPaidLogService.listMerchantByManagerId().then(function(data) {
        $scope.listMerchantByManagerId = eval(data.bizData);
    });
	// 查詢
	$scope.queryOrderInfo = function() {
		$scope.query = null;
		queryPagination(doParam());
	}
});
